home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
10,000 Great Games
/
10,000 Great Games.iso
/
Product
/
66
/
data1.cab
/
Source_Files
/
Src
/
Dinput.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2000-01-16
|
713b
|
32 lines
#include "stdafx.h"
LPDIRECTINPUT DI = 0;
void init_directinput()
{
if (FAILED(DirectInputCreate(theApp.m_hInstance, DIRECTINPUT_VERSION, &DI, 0)))
error("Unable to create DirectInput interface\n\n"
"Did you install DirectX 6.0 or higher?");
}
void deinit_directinput()
{
safe_release(&DI);
}
LPDIRECTINPUTDEVICE2 create_input_device(GUID guid)
{
LPDIRECTINPUTDEVICE id1;
LPDIRECTINPUTDEVICE2 id2;
if (FAILED(DI->CreateDevice(guid, &id1, 0)))
error("Unable to get DirectInputDevice interface");
if (FAILED(id1->QueryInterface(IID_IDirectInputDevice2, (LPVOID *)&id2)))
error("Unable to get DirectInputDevice2 interface");
id1->Release();
return id2;
}